In [43]:
import requests
from bs4 import BeautifulSoup
In [44]:
#r = requests.get("http://www.gog.com")
r = requests.get("http://pythonforengineers.com/secret/")
soup = BeautifulSoup(r.text, "lxml")
In [45]:
for pelem in soup.find_all('p'):
print(pelem.text)
In [46]:
from selenium import webdriver
In [47]:
driver = webdriver.Firefox()
In [48]:
driver.get("http://pythonforengineers.com/secret/")
In [49]:
text = driver.find_element_by_tag_name('p')
print(text.text)
In [50]:
button = driver.find_element_by_xpath("/html/body/div[1]/div/div[2]/div/div[1]/article/div/button")
print(button.text)
In [51]:
button2 = driver.find_element_by_xpath("//*[contains(text(), 'Super')]")
print(button2.text)
In [52]:
button2.click()
In [53]:
text = driver.find_element_by_tag_name('p')
print(text.text)
In [55]:
driver.close()
In [ ]: